import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class VicTomcat {

    public static void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(8000);

        Socket socket = server.accept();
        InputStream inputStream =  socket.getInputStream();
        String str = null;
        int len = 0;
        byte[] buffer = new byte[1024];
        while((len = inputStream.read(buffer))>0){
            System.out.println(new String(buffer,0,len));
        }

        OutputStream out = socket.getOutputStream();

        out.write("hhello".getBytes());
        out.flush();
    }
}
